﻿using System;
using Microsoft.Practices.Prism.Logging;

namespace Hopscotch.Common.Logging
{
    public sealed class PrismLogger : AppLogger, ILoggerFacade
    {
        private PrismLogger(NLog.Logger logger)
            : base(logger)
        {
        }

        void ILoggerFacade.Log(string message, Category category, Priority priority)
        {
            switch (category)
            {
                case Category.Debug:
                    logger.Debug(message);
                    break;
                case Category.Warn:
                    logger.Warn(message);
                    break;
                case Category.Exception:
                    logger.Error(message);
                    break;
                case Category.Info:
                    logger.Info(message);
                    break;
            }
        }

        public static ILoggerFacade CreateLoggerFacade(Type type)
        {
            return new PrismLogger(NLog.LogManager.GetLogger(type.Name));
        }

    }
}
